/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package iteratorapplication;

/**
 *
 * @author Ramon
 */
public class Client {
    public static void main(String[] args) {
        CompteCorrent cc1 = new CompteCorrent();
        CompteCorrent2 cc2 = new CompteCorrent2();
        CompteCorrent3 cc3 = new CompteCorrent3();

        Titular t1 = new Titular();
        Titular t2 = new Titular();
        t1.setNom("Ramon");
        t1.setCognoms("Gras");
        t2.setNom("Andreu");
        t2.setCognoms("Buenafuente");
        cc3.add(t1);
        cc3.add(t2);
        
//        cc1.addTitular("pepe");
//        cc1.addTitular("maria");
//        cc1.addTitular("joan");
//         cc1.addTitular("tere");
//        cc1.addTitular("juana");
//        cc1.addTitular("lourdes");
//
        
        while (cc1.hasNext()){
            System.out.println(cc1.next());
        }
//        IteratorIf iterator = cc2.iterator();
//        while(iterator.hasNext()){
//            System.out.println(iterator.next());
//        }
        IteratorIf iterator2 = cc3.iterator();
          
        while(iterator2.hasNext()){
              Titular nombre = (Titular) iterator2.next();
              System.out.println(nombre.getNom() +" "+  nombre.getCognoms());
        }

    }

}
